package flexdb

import (
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
	tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http"
	"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
)

const APIVersion = "2018-11-27"

type Client struct {
	common.Client
}

// Deprecated
func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) {
	cpf := profile.NewClientProfile()
	client = &Client{}
	client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf)
	return
}

func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) {
	client = &Client{}
	client.Init(region).
		WithCredential(credential).
		WithProfile(clientProfile)
	return
}

func NewListTablesRequest() (request *ListTablesRequest) {
	request = &ListTablesRequest{
		BaseRequest: &tchttp.BaseRequest{},
	}
	request.Init().WithApiInfo("flexdb", APIVersion, "ListTables")
	return
}

func NewListTablesResponse() (response *ListTablesResponse) {
	response = &ListTablesResponse{
		BaseResponse: &tchttp.BaseResponse{},
	}
	return
}

// 本接口 ListTables
func (c *Client) ListTables(request *ListTablesRequest) (response *ListTablesResponse, err error) {
	if request == nil {
		request = NewListTablesRequest()
	}
	response = NewListTablesResponse()
	err = c.Send(request, response)
	return
}

func NewQueryRequest() (request *QueryRequest) {
	request = &QueryRequest{
		BaseRequest: &tchttp.BaseRequest{},
	}
	request.Init().WithApiInfo("flexdb", APIVersion, "Query")
	return
}

func NewQueryResponse() (response *QueryResponse) {
	response = &QueryResponse{
		BaseResponse: &tchttp.BaseResponse{},
	}
	return
}

// 本接口 Query
func (c *Client) Query(request *QueryRequest) (response *QueryResponse, err error) {
	if request == nil {
		request = NewQueryRequest()
	}
	response = NewQueryResponse()
	err = c.Send(request, response)
	return
}

func NewPutItemRequest() (request *PutItemRequest) {
	request = &PutItemRequest{
		BaseRequest: &tchttp.BaseRequest{},
	}
	request.Init().WithApiInfo("flexdb", APIVersion, "PutItem")
	return
}

func NewPutItemResponse() (response *PutItemResponse) {
	response = &PutItemResponse{
		BaseResponse: &tchttp.BaseResponse{},
	}
	return
}

// 本接口 PutItem
func (c *Client) PutItem(request *PutItemRequest) (response *PutItemResponse, err error) {
	if request == nil {
		request = NewPutItemRequest()
	}
	response = NewPutItemResponse()
	err = c.Send(request, response)
	return
}
